package com.mygame.common.msg;


import java.util.HashMap;
import java.util.Map;

public enum CommandEnum {
    C2S_DEFAULT(0, "C2S_DEFAULT", ServiceEnum.GAME_LOGIC),
    C2S_CON_FIRM(1, "C2S_CON_FIRM", ServiceEnum.GAME_LOGIC),
    C2S_HEART_BEAT(2, "C2S_HEART_BEAT", ServiceEnum.GAME_LOGIC),
    C2S_TEST(1001, "C2S_TEST", ServiceEnum.GAME_LOGIC),
    C2S_TEST2(1002, "C2S_TEST2", ServiceEnum.GAME_LOGIC),
    C2S_IM_SEND(311, "C2S_IM_SEND", ServiceEnum.GAME_LOGIC),
    S2C_IM_SEND(200311, "S2C_IM_SEND", ServiceEnum.GAME_LOGIC),
    C2S_SEND_IM_MSG(312, "C2S_SEND_IM_MSG", ServiceEnum.GAME_LOGIC),
    S2C_SEND_IM_MSG(2000312, "S2C_SEND_IM_MSG", ServiceEnum.GAME_LOGIC),

    C2S_ENTER_GAME(201, "C2S_ENTER_GAME", ServiceEnum.GAME_LOGIC),
    S2C_ENTER_GAME(200001, "S2C_ENTER_GAME", ServiceEnum.GAME_LOGIC),

    C2S_GET_PLAYER_BY_ID(202, "C2S_GET_PLAYER_BY_ID", ServiceEnum.GAME_LOGIC),
    S2C_GET_PLAYER_BY_ID(200002, "S2C_GET_PLAYER_BY_ID", ServiceEnum.GAME_LOGIC),


    C2S_GET_ARENA_PLAYER_LIST(203, "C2S_GET_ARENA_PLAYER_LIST", ServiceEnum.GAME_LOGIC),
    S2C_GET_ARENA_PLAYER_LIST(200003, "S2C_GET_ARENA_PLAYER_LIST", ServiceEnum.GAME_LOGIC),

    C2S_BUY_ARENA_CHALLENGE_TIMES_REQ(210, "C2S_BUY_ARENA_CHALLENGE_TIMES", ServiceEnum.GAME_ARENA),
    S2C_BUY_ARENA_CHALLENGE_TIMES_RSP(200010, "S2C_BUY_ARENA_CHALLENGE_TIMES", ServiceEnum.GAME_LOGIC),


    S2C_HEART_BEAT(1000002, "S2C_HEART_BEAT", ServiceEnum.GAME_LOGIC),
    S2C_CON_FIRM(2001, "S2C_CON_FIRM", ServiceEnum.GAME_LOGIC),

    RPC_CONSUME_DIAMOND_REQ(204, "RPC_CONSUME_DIAMOND_REQ", ServiceEnum.GAME_LOGIC),
    RPC_CONSUME_DIAMOND_RSP(2000204, "RPC_CONSUME_DIAMOND_RSP", ServiceEnum.GAME_LOGIC),
    ;


    public int id;
    public String cmdName;
    public ServiceEnum service;

    CommandEnum(int id, String cmd, ServiceEnum service) {
        this.cmdName = cmd;
        this.id = id;
        this.service = service;
    }

    public static Map<Integer, CommandEnum> cmdMap = new HashMap<>();

    static {
        for (CommandEnum cmd : CommandEnum.values()) {
            cmdMap.put(cmd.id, cmd);
        }
    }


    public static CommandEnum find(int cmdId) {
        return cmdMap.get(cmdId);
    }

}
